home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 037a / tpfast40.zip / T_KBD.PAS < prev    next >
Pascal/Delphi Source File  |  1991-11-14  |  3KB  |  107 lines

  1. { -------------------------------------------------------------------------- }
  2. {                                   t_kbd;                                   }
  3. {                  demo of keyboard functions for TPFAST                     }
  4. { -------------------------------------------------------------------------- }
  5. uses dos,crt,tpfast;
  6.  
  7.  
  8. var ch                 :word;
  9.  
  10.  
  11. { -------------------------------------------------------------------------- }
  12. procedure pollkeys;
  13.  
  14. begin
  15.  if capslockon then dspat('Capslock is         ON ',1,3,lightcyan)
  16.     else            dspat('Capslock is         OFF',1,3,lightcyan);
  17.  if inskeyon then   dspat('Insert key is       ON ',1,4,lightcyan)
  18.     else            dspat('Insert key is       OFF',1,4,lightcyan);
  19.  if numlockon then  dspat('Numlock key is      ON ',1,5,lightcyan)
  20.     else            dspat('Numlock key is      OFF',1,5,lightcyan);
  21.  if scrolllockon then
  22.                     dspat('Scroll lock key is  ON ',1,6,lightcyan)
  23.     else            dspat('Scroll lock key is  OFF',1,6,lightcyan);
  24.  
  25.  
  26.  if altkeydown then dspat('ALT ',1,1,lightgreen)
  27.     else dspat('    ',1,1,lightgreen);
  28.  if capslockdown then dspat('CAPS ',6,1,lightgreen)
  29.     else dspat('     ',6,1,lightgreen);
  30.  if inskeydown then dspat('INS ',12,1,lightgreen)
  31.     else dspat('    ',12,1,lightgreen);
  32.  if leftshiftdown then dspat('LSHIFT ',17,1,lightgreen)
  33.     else dspat('       ',17,1,lightgreen);
  34.  if rightshiftdown then dspat('RSHIFT ',26,1,lightgreen)
  35.     else dspat('       ',26,1,lightgreen);
  36.  if ctrlkeydown then dspat('CTRL ',34,1,lightgreen)
  37.     else dspat('     ',34,1,lightgreen);
  38.  if scrolllockdown then dspat('SCROLL-LOCK ',40,1,lightgreen)
  39.     else dspat('            ',40,1,lightgreen);
  40.  if numlockdown then dspat('NUM-LOCK ',53,1,lightgreen)
  41.     else dspat('         ',53,1,lightgreen);
  42. end;
  43.  
  44. { -------------------------------------------------------------------------- }
  45. procedure statusmsg;
  46.  
  47. begin
  48.  dspat('Press Alt, Shift, Ctrl, Ins, Numlock, Scrollock  keys ....',1,22,
  49.        lightred);
  50.  dspat('Press F1 to set all keys  ..',1,24,lightred);
  51.  dspat('Press F2 to clear all keys  ..',1,25,lightred);
  52. end;
  53.  
  54. { -------------------------------------------------------------------------- }
  55. procedure setkeys;
  56.  
  57. begin
  58.   setcapslock;
  59.   setnumlock;
  60.   setscrolllock;
  61.   setins;
  62. end;
  63.  
  64. { -------------------------------------------------------------------------- }
  65. procedure clearkeys;
  66.  
  67. begin
  68.   clearcapslock;
  69.   clearnumlock;
  70.   clearscrolllock;
  71.   clearins;
  72. end;
  73.  
  74. { -------------------------------------------------------------------------- }
  75.  
  76. begin
  77. textattr := white;
  78. ch := NULL;
  79. cursoroff;
  80. clrscr;
  81. statusmsg;
  82.   repeat
  83.    if keypressed then
  84.      begin
  85.         ch := getkey;
  86.         if ch = F1 then setkeys;
  87.         if ch = F2 then clearkeys;
  88.      end;
  89.    pollkeys;
  90.   until ch = Esc;
  91. cursoron;
  92. end.
  93.  
  94.  
  95.  
  96. { -------------------------------------------------------------------------- }
  97.  
  98.   These following procedure have no examples as yet ..............
  99.  
  100.   clearbuffer;
  101.   freshcahr;
  102.   keypause;
  103.   lastkey;
  104.   nextkey;
  105.  
  106. { -------------------------------------------------------------------------- }
  107.